package com.chengqs.rainbow.im.route;

import com.chengqs.rainbow.im.route.server.RouteServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.kafka.annotation.EnableKafka;

/**
 * <B>主类名称：</B>ImRouteApplication<BR>
 * <B>概要说明：</B>enter<BR>
 *
 * @author: chengqs
 * @create: 2025-09-13 17:15:48
 **/
@SpringBootApplication
@EnableKafka
public class ImRouteApplication implements ApplicationListener<ApplicationReadyEvent> {
    @Autowired
    private RouteServer routeServer;

    public static void main(String[] args) {
        SpringApplication application = new SpringApplication(ImRouteApplication.class);
        application.setWebApplicationType(WebApplicationType.SERVLET);
        application.run(args);
    }

    @Override
    public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
        routeServer.start();
    }
}
